home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / Libraries / tcl7.4b3 / doc / gets.n < prev    next >
Encoding:
Text File  |  1994-12-17  |  1.7 KB  |  49 lines

  1. '\"
  2. '\" Copyright (c) 1993 The Regents of the University of California.
  3. '\" Copyright (c) 1994 Sun Microsystems, Inc.
  4. '\"
  5. '\" See the file "license.terms" for information on usage and redistribution
  6. '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  7. '\" 
  8. '\" @(#) gets.n 1.3 94/12/17 16:18:01
  9. '\" 
  10. .so man.macros
  11. .HS gets tcl
  12. .BS
  13. '\" Note:  do not modify the .SH NAME line immediately below!
  14. .SH NAME
  15. gets \- Read a line from a file
  16. .SH SYNOPSIS
  17. \fBgets \fIfileId\fR ?\fIvarName\fR?
  18. .BE
  19.  
  20. .SH DESCRIPTION
  21. .PP
  22. This command reads the next line from the file given by \fIfileId\fR
  23. and discards the terminating newline character.
  24. If \fIvarName\fR is specified then the line is placed in the variable
  25. by that name and the return value is a count of the number of characters
  26. read (not including the newline).
  27. If the end of the file is reached before reading
  28. any characters then \-1 is returned and \fIvarName\fR is set to an
  29. empty string.
  30. If \fIvarName\fR is not specified then the return value will be
  31. the line (minus the newline character) or an empty string if
  32. the end of the file is reached before reading any characters.
  33. An empty string will also be returned if a line contains no characters
  34. except the newline, so \fBeof\fR may have to be used to determine
  35. what really happened.
  36. If the last character in the file is not a newline character then
  37. \fBgets\fR behaves as if there were an additional newline character
  38. at the end of the file.
  39. \fIFileId\fR must be \fBstdin\fR or the return value from a previous
  40. call to \fBopen\fR; it must refer to a file that was opened
  41. for reading.
  42. .VS
  43. Any existing end-of-file or error condition on the file is cleared at
  44. the beginning of the \fBgets\fR command.
  45. .VE
  46.  
  47. .SH KEYWORDS
  48. file, line, read
  49.